<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jQuery类选择器</title>
    <script src="/D:/TempFiles/IntellijIdea/Pisum/SimpleWeb/src/main/webapps/libs/jquery-1.11.3.js"></script>
    <style>
        div {
            color: red;
            /*background: white;*/
            width: 100px;
            height: 90px;
            float: left;
            padding: 5px;
            margin: 5px;
            background-color: #EEEEEE;
        }
    </style>
</head>
<body>

<div class="aaron">
    <p>class="aaron"</p>
    <p>选中</p>
</div>
<div class="aaron">
    <p>class="aaron"</p>
    <p>选中</p>
</div>
<div class="imooc">
    <p>class="imooc"</p>
    <p>文字部分</p>
</div>
<div class="imooc">
    <p>class="imooc"</p>
    <p>文字部分</p>
</div>

<script type="text/javascript">
    //通过原生方法处理
    var divs = document.getElementsByClassName('aaron');
    for (var i = 0; i < divs.length; i++) {
        divs[i].style.border = "3px solid blue";
    }
</script>

<script type="text/javascript">
    //通过jQuery直接传入class
    //class多个时也不需要循环
    $(".imooc").css("border", "3px solid red");
</script>
</body>
</html>